<?php

    include './sql.php';

    // 获取前端发来的信息
    $user = $_REQUEST["user"];
    $password = $_REQUEST["password"];

    // 获取数据库的信息
    // $d = queryOne("SELECT * FROM user WHERE user='".$user."'");
    
    $d = queryOne("SELECT * FROM user WHERE user='".$user."'");

    if($d[0]["user"]==$user){
        if(strcmp($password,$d[0]["password"])==0){
            $backData = array("code"=>2,"errMsg"=>"","sucMsg"=>"登录成功","data"=>$d);
            die(json_encode($backData));
        }else{
            $backData = array("code"=>1,"errMsg"=>"密码错误","sucMsg"=>"");
            die(json_encode($backData));
        }
    }else{
        $backData = array("code"=>1,"errMsg"=>"账号不存在","sucMsg"=>"");
        die(json_encode($backData));
    }
  

?>

   



